import React, { Component } from 'react';
import './Foot.css';
import axios from 'axios';

class Foot extends Component {
    
    constructor(props) {
        super(props)
        this.state = { remoteMessage: [] };
    }

    // http://localhost:23386/k2.svc/api/Test
    componentDidMount() {
        axios.get('http://localhost:23386/').then(r => {
            // console.log(r.data)
            this.setState(prevState => ({
                remoteMessage: prevState.remoteMessage.concat(r.data)
            }))
        })
    }

    render() {
        return (
            <div className="foot">
                <h1>RemoteMessage</h1>
                <ul>
                {this.state.remoteMessage.map((msg, index) => (
                    <li key={index}>{msg}</li>
                ))}
                </ul>
            </div>
        )
    }
}

export default Foot;